function buttonFormatter(value, row,index) {
	var caozuo1= "<button id='btn_edit' type='button' onclick='_update("+row.rowId+");'  class='btn btn-default btn-sm'><span class='glyphicon glyphicon-pencil'></span>修 改</button>";
	var caozuo2 = "<button id='btn_edit' type='button' onclick='deleteEmp("+row.rowId+", \""+row.gameId+"\", \""+row.patchVersion+"\");'  class='btn btn-default btn-sm'><span class='glyphicon glyphicon-remove'></span>&nbsp;删&nbsp;除&nbsp;</button>";
	return caozuo1+caozuo2; 
}
   
function appKindFormatter(value, row) {
    if (row.appKind == 10) {
        return ' ios';
    } else if (row.appKind == 20) {
        return ' 安卓';
    } else {
    	//暂无业务
    }
}
//游戏名称
function gameNameFormatter(value, row) {
	return getTableColumnValueByDict($("#gameNameListJson").val(),value);
} 
// 加载table 数据
$(function(){
    $("#dataTable").bootstrapTable({ 
    	url: "/hotUpdate/list.json",
    	method:"get", 
    	pagination:true,
    	sidePagination:"server",
    	queryParams: function(params) {
            return $.extend({}, params, parseJson(decodeURIComponent($("#dataForm").serialize())));     
        }
   }); 
 })
// 弹出添加的窗口
function add(){
	layer.open({
 	  	type: 2,
	 	title: "添加热更新信息",
 	  	closeBtn: 1,
 	  	shadeClose: true,
 	  	area: ['600px', '430px'],
 	  	content: '/hotUpdate/toAddHotUpdate',
 	  	btn: ["确 认","关 闭"], 
 	  	yes: function(index, layero){
	    	var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：
	        iframeWin.add();
		}
	});
}
 // 弹出添加的窗口      修改功能
function _update(rowId){
	layer.open({
 	  	type: 2,
 	  	title: "修改热更新信息",
 	  	closeBtn: 1,
 	  	shadeClose: true,
 	  	area: ['600px', '435px'],
 	  	content: '/hotUpdate/toAddHotUpdate?rowId='+rowId,
 	  	btn: ["确 认","关 闭"], 
 	  	yes: function(index, layero) {
	    	var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：
	        iframeWin.add();
		}
	});
}
//删除热更新信息
function deleteEmp(rowId, gameId, patchVersion){
	var gameName = getTableColumnValueByDict($("#gameNameListJson").val(),gameId);
	var descStr ='【删除】<a style="color:red">'+'"'+gameName+"的"+patchVersion+'"'+'</a>';
	layer.confirm('您确认'+descStr+'版本补丁吗?', {
		btn: ['确认', '取消']  
	},
	function(){
		var url = "/hotUpdate/deleteHotUpdate?rowId="+rowId;
    	$.post(url,null,function(data){
  		    if (data == 1) { 
  		   		layer.alert("操作成功", {icon: 1});
  		   		findData();
  			} else {
  				layer.alert("操作失败", {icon: 5});
  			}
		});
	},
	function(){ 
		return;
	});
}
function findData(){
   $("#dataTable").bootstrapTable("refresh",{} ); 
}

$(function(){
	 $("body").on("click","table>tbody>tr",function(){
      $(this).css("background","#e1ecf1").siblings().css("background","");
   });
})